<?php

/**
 * Created by IntelliJ IDEA.
 * User: sun
 * Date: 2017/6/22
 * Time: 上午9:45
 */
namespace app\base;
use think\Controller;
class Logger extends Controller
{
//    public function error(){
//
//    }

    public static function debug($msg){
        $msg = beJson($msg);
        $path = dirname(__FILE__).'/../api/view/debug/index.html';
        $content = file_get_contents($path);
        $array = explode('</div>',$content);
        file_put_contents($path,$array[0].$msg.'<br></div>'.$array[1]);
    }

    public static function cleanDebug(){
        $path = dirname(__FILE__).'/../api/view/debug/index.html';
        $content = file_get_contents($path);
        $array1 = explode('<div id = "logs">',$content);
        $array2 = explode('</div>',$content);
        file_put_contents($path,$array1[0].'<div id = "logs"></div>'.$array2[1]);
    }

}